import java.util.List;
import java.util.ArrayList;


public class Main {
    public static void main(String[] args) {
        List<JourneyCharacter> characters = new ArrayList<>();
        characters.add(new JourneyCharacter("孙悟空"));
        characters.add(new JourneyCharacter("猪八戒"));
        characters.add(new JourneyCharacter("沙和尚"));
        characters.add(new JourneyCharacter("唐僧"));

        IJourneyIterator iterator = new JourneyCharacterIterator(characters);

        System.out.println("《西游记》的角色列表：");
        while (iterator.hasNext()) {
            JourneyCharacter character = iterator.next();
            System.out.println(character.getName());
        }


    }
}